<!DOCTYPE html>
<html lang="en">
<#include "../common/scripts.html">
<#include "../common/scripts_add.html">
<body>
<div class="page-content">
    <div class="fh-subtitle">应用管理信息</div>
    <form action="" method="post" id="editForm" class="form-horizontal">
        <input type="text"  id="id"  name="id" value="${application.id!}" class="hide">
        <table class="table-main" style="width: 80% !important;">
            <tr>
                <td style="width: 10% !important;"><span class="required-flag">*</span><span>应用编码</span></td>
                <td style="width: 40%;">
                    <input  class="form-control-gx" value="${application.applicationCode!}" name="applicationCode" id="applicationCode" autocomplete="off"/>
                </td>
                <td style="width: 10% !important;"><span class="required-flag">*</span><span>应用名称</span></td>
                <td style="width: 40%;">
                    <input  class="form-control-gx" value="${application.applicationName!}" name="applicationName" id="applicationName" autocomplete="off"/>
                </td>
            </tr>
            <tr>
                <td><span>首页</span></td>
                <td><input type="text" class="form-control-gx"  value="${application.url!}" name="url" id="url" autocomplete="off"></td>
                <td ><span>排序</span></td>
                <td >
                    <input  class="form-control-gx" value="${application.sort!}" name="sort" id="sort" onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" autocomplete="off"/>
                </td>
            </tr>
            <tr>
                <td ><span>说明</span></td>
                <td  colspan="3">
                    <input  class="form-control-gx" type="text" name="remark" id = "remark" value="${application.remark!}" style="height: 50px;" autocomplete="off">
                </td>
            </tr>
        </table>
    </form>
    <div class="text-center" style="width: 1000px; margin-top: 20px; ">
        <span class="model-btn" onclick="submit()" style="width:80px;">保存</span>
    </div>
</div>
<script>
    $(function(){
        var id = '${application.id!}';
        if(!isEmpty(id)){
            $("#applicationCode").attr("readonly","readonly")
        }else{
            $("#sort").val("1");
        }
    });
    function submit() {

        if(isEmpty_byJqObj($("#applicationCode"))){
            sys.topmsg("系统编码不能为空");
            return false;
        }
        if(isEmpty_byJqObj($("#applicationName"))){
            sys.topmsg("系统名称不能为空");
            return false;
        }
     /*   if(isEmpty_byJqObj($("#sort"))){
            sys.topmsg("排序不能为空");
            return false;
        }*/
        $.ajax({
            url : "${ctx}/application/saveOrUpdate",
            type : "POST",
            datatype : "json",
            data : $('#editForm').serialize(),
            success : function(res) {
                if (res.success) {
                    js.showMessage(res.data,"","success",1500)
                    js.closeCurrentTabPage(function(contentWindow){
                        contentWindow.reload();
                    });
                } else {
                    sys.topmsg(res.message);
                }
            },
            error : function(data) {
                js.showMessage("请求异常！","","error",1500)
            }
        });
    }
</script>
</body>
</html>